package com.laguille.games.monopoly.server;

import com.laguille.games.monopoly.commons.player.Player;
import com.laguille.games.monopoly.commons.property.Property;

/**
 * This interface is the public API used by the client or a third-party application to interact with the application.
 * The implementation will wire all the internal components together.
 * None of the methods return a result. Instead, the caller must register its interest to receive game events.
 *
 */
public interface GameController {

	/**
	 * Register a new player in the game.
	 * @param player the player to register.
	 */
	public void registerPlayer(Player player);
	
	
	/**
	 * Starts a game with the registered players.
	 * @throws IllegalStateException thrown when no players have been previously registered.
	 */
	public void startGame();
	
	/**
	 * Roll the dice and triggers all subsequent actions (moving a player, paying a rent, going to prison, ...)
	 * @param player the player who is rolling the dice
	 */
	public void rollDice(Player player); 
	
	/**
	 * Buy the <code>property</code> for a given player.
	 * The method first checks if there are sufficient funds to carry out the transaction.
	 * @param player the buyer.
	 * @param property the property to purchase.
	 */
	public void buyProperty(Player player, Property property);
	
	// buyHouse
	
	// sellHouse
	
	// trade
	
	// mortgage
	
	// registerInterest

	/**
	 * Finish the current player turn. 
	 * For the turn to end, a player needs to have a positive cash balance.
	 * @param 	player the current player
	 */
	public void endTurn(Player player);
	
	/**
	 * Returns the event bus.
	 * @return the event bus.
	 */
	public EventBus getEventBus();
	// gameOver: players decides to stop as he can't pay back his debt or want to quit the game
}
